//
//  CellForVideoType.m
//  世界
//
//  Created by admin on 16/2/14.
//  Copyright © 2016年 admin. All rights reserved.
//

#import "CellForVideoType.h"

@implementation CellForVideoType

#pragma mark 重写dealloc方法
- (void)dealloc
{
    [super dealloc];
    
    [_imageView release];
    
    [_lableForTitle release];
}




#pragma mark 重写初始化方法
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self != nil)
    {
        //创建子控件
        self.imageView = [[UIImageView alloc] init];
        
        [self.contentView addSubview:self.imageView];
        
        [_imageView release];
        
        self.lableForTitle = [[UILabel alloc] init];
        
        [self.contentView addSubview:self.lableForTitle];
        
        [_lableForTitle release];
    }
    return self;
}


#pragma mark 布局子控件
//collectionCell 的子控件的布局通常在此方法中设置
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.imageView.frame = CGRectMake(20, 10, self.contentView.frame.size.width - 20 - 20, self.contentView.frame.size.width - 20 - 20);
    
    self.imageView.layer.cornerRadius = (self.contentView.frame.size.width - 20 - 20) / 2;
    
    self.imageView.layer.masksToBounds = YES;
    
    self.imageView.layer.borderWidth = 2;
    
    self.imageView.layer.borderColor = [[UIColor orangeColor] CGColor];
    
    self.lableForTitle.frame = CGRectMake(0, self.contentView.frame.size.width - 20 + 20, self.contentView.frame.size.width, self.contentView.frame.size.height - self.contentView.frame.size.width - 20 - 10);
    
    //文字居中
    self.lableForTitle.textAlignment = NSTextAlignmentCenter;
}


@end
